#include <algorithm>
#include <cstdio>

typedef long long ll;
const int N = 100005, bit = 22, mod = 1e9 + 7;
int n, m, siz, a[N], base[bit], ans[N];

struct Query {
  int l, x, id;
  inline bool operator<(const Query &rhs) const { return l < rhs.l; }
} q[N];

inline void insert(int x) {
  for (int i = bit - 1; ~i; --i) {
    if ((x >> i) & 1) {
      if (base[i])
        x ^= base[i];
      else {
        base[i] = x;
        ++siz;
        break;
      }
    }
  }
}

inline bool check(int x) {
  for (int i = bit - 1; ~i; --i) {
    if ((x >> i) & 1) {
      if (base[i])
        x ^= base[i];
      else
        return false;
    }
  }
  return true;
}

inline ll qpow(ll x, int exp) {
  ll res = 1;
  while (exp) {
    if (exp & 1) res = res * x % mod;
    x = x * x % mod;
    exp >>= 1;
  }
  return res;
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("CF959F xor task.in", "r", stdin);
  freopen("CF959F xor task.out", "w", stdout);
#endif
#endif

  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }

  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &q[i].l, &q[i].x);
    q[i].id = i;
  }
  std::sort(q + 1, q + m + 1);
  for (int i = 1, cnt = 0; i <= m; ++i) {
    while (cnt < q[i].l) insert(a[++cnt]);
    if (check(q[i].x)) ans[q[i].id] = qpow(2, cnt - siz);
  }
  for (int i = 1; i <= m; ++i) printf("%d\n", ans[i]);
  return 0;
}